<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<title>Manager</title>
</h:head>
<body>
	<ui:composition template="/pages/common/commonLayout.xhtml">
		<ui:define name="content">

			<f:event listener="#{visitMB.onStart}" type="preRenderView" />
			<h:form>
				<p:panel id="panel" header="Dane" toggleable="true" closable="false"
					toggleSpeed="500" closeSpeed="500" widgetVar="panel"
					style="margin-bottom:20px">
					<table>
						<tr>
							<td><h:outputLabel value="Data przypomnienia" /></td>
							<td><p:calendar required="true" locale="pl" navigator="true" effect="fold"
									value="#{visitMB.addedNotification.date}" /></td>
						</tr>
						<tr>
							<td><h:outputLabel value="Kanal" /></td>
							<td><p:selectOneMenu required="true"
									value="#{visitMB.addedNotification.canal}">
									<f:selectItems value="#{enumBean.canals}" var="canal"
										itemLabel="#{canal}" itemValue="#{canal}" />
									<p:ajax event="change" update="@form"
										listener="#{visitMB.chooseCanal}" />
								</p:selectOneMenu></td>
						</tr>
						<tr>
							<td><c:if test="#{visitMB.addedNotification.canal.sms}">
									<p:selectOneMenu required="true"
										value="#{visitMB.addedNotification.address}">
										<f:selectItems value="#{visitMB.addressesSms}" />
									</p:selectOneMenu>
								</c:if> <c:if test="#{!visitMB.addedNotification.canal.sms}">
									<p:selectOneMenu required="true"
										value="#{visitMB.addedNotification.address}">
										<f:selectItems value="#{visitMB.addressesEmail}" />
									</p:selectOneMenu>
								</c:if></td>
						</tr>
						<tr>
							<td><p:commandButton icon="ui-icon-plus" value="Zapisz"
									action="#{visitMB.saveNotification}" /></td>
						</tr>
					</table>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</body>
</html>
